package com.owen.he.jee.service.impl.excel;

import java.util.List;

import com.owen.he.jee.model.CellTemplate;
import com.owen.he.jee.model.ExportTemplate;

public class XmlMainTest {
	public static void main(String[] args) {
//		ExportTemplate f = new ExportTemplate();
//		CellTemplate cell = new CellTemplate();
//		cell.setName("test1");
//		CellTemplate cell1 = new CellTemplate();
//		cell1.setName("test2");
//		List<CellTemplate> d = new ArrayList<CellTemplate>();
//		d.add(cell);
//		d.add(cell1);
//		f.setCell(d);
//    	f.setBarName("业绩关系");
//    	XMLFactory.beanToXmlFile(f, "E:\\usr\\template\\", "excelTemplate.xml");

		XMLFactory xmlf = new XMLFactory(ExportTemplate.class);
		try {
			ExportTemplate data = xmlf.xmlFileToBean("E:\\usr\\template\\excelTemplate.xml", ExportTemplate.class);
			//ExportExcelData data = xmlf.XML2Bean(ExportExcelData.class, "/Users/hetangdong/Documents/workspace/logs/excelTemplate.xml");
			List<CellTemplate> datas  = data.getCell();
			System.out.println("size->>>"+datas.size());
			for (CellTemplate d : datas) {
				System.out.println("field->>>"+d.getName());
			}
			
			System.out.println("name->>>"+data.getBarName());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
	}
}
